home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Magazine / Morphos / GCC / ppc-amigaos / include / stdarg.h < prev    next >
C/C++ Source or Header  |  1999-08-03  |  6KB  |  213 lines

  1. /* stdarg.h for GNU.
  2.    Note that the type used in va_arg is supposed to match the
  3.    actual type **after default promotions**.
  4.    Thus, va_arg (..., short) is not valid.  */
  5.  
  6. #ifndef _STDARG_H
  7. #ifndef _ANSI_STDARG_H_
  8. #ifndef __need___va_list
  9. #define _STDARG_H
  10. #define _ANSI_STDARG_H_
  11. #endif /* not __need___va_list */
  12. #undef __need___va_list
  13.  
  14. #ifdef __clipper__
  15. #include "va-clipper.h"
  16. #else
  17. #ifdef __m88k__
  18. #include "va-m88k.h"
  19. #else
  20. #ifdef __i860__
  21. #include "va-i860.h"
  22. #else
  23. #ifdef __hppa__
  24. #include "va-pa.h"
  25. #else
  26. #ifdef __mips__
  27. #include "va-mips.h"
  28. #else
  29. #ifdef __sparc__
  30. #include "va-sparc.h"
  31. #else
  32. #ifdef __i960__
  33. #include "va-i960.h"
  34. #else
  35. #ifdef __alpha__
  36. #include "va-alpha.h"
  37. #else
  38. #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
  39. #include "va-h8300.h"
  40. #else
  41. #if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
  42. #include "va-ppc.h"
  43. #else
  44. #ifdef __arc__
  45. #include "va-arc.h"
  46. #else
  47. #ifdef __M32R__
  48. #include "va-m32r.h"
  49. #else
  50. #ifdef __sh__
  51. #include "va-sh.h"
  52. #else
  53. #ifdef __mn10300__
  54. #include "va-mn10300.h"
  55. #else
  56. #ifdef __mn10200__
  57. #include "va-mn10200.h"
  58. #else
  59. #ifdef __v850__
  60. #include "va-v850.h"
  61. #else
  62. #if defined (_TMS320C4x) || defined (_TMS320C3x)
  63. #include <va-c4x.h>
  64. #else
  65.  
  66. /* Define __gnuc_va_list.  */
  67.  
  68. #ifndef __GNUC_VA_LIST
  69. #define __GNUC_VA_LIST
  70. #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
  71. typedef char *__gnuc_va_list;
  72. #else
  73. typedef void *__gnuc_va_list;
  74. #endif
  75. #endif
  76.  
  77. /* Define the standard macros for the user,
  78.    if this invocation was from the user program.  */
  79. #ifdef _STDARG_H
  80.  
  81. /* Amount of space required in an argument list for an arg of type TYPE.
  82.    TYPE may alternatively be an expression whose type is used.  */
  83.  
  84. #if defined(sysV68)
  85. #define __va_rounded_size(TYPE)  \
  86.   (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
  87. #elif defined(_AIX)
  88. #define __va_rounded_size(TYPE)  \
  89.   (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
  90. #else
  91. #define __va_rounded_size(TYPE)  \
  92.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  93. #endif
  94.  
  95. #define va_start(AP, LASTARG)                         \
  96.  (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
  97.  
  98. #undef va_end
  99. void va_end (__gnuc_va_list);        /* Defined in libgcc.a */
  100. #define va_end(AP)    ((void)0)
  101.  
  102. /* We cast to void * and then to TYPE * because this avoids
  103.    a warning about increasing the alignment requirement.  */
  104.  
  105. #if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
  106. /* This is for little-endian machines; small args are padded upward.  */
  107. #define va_arg(AP, TYPE)                        \
  108.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  109.   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
  110. #else /* big-endian */
  111. /* This is for big-endian machines; small args are padded downward.  */
  112. #define va_arg(AP, TYPE)                        \
  113.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  114.   *((TYPE *) (void *) ((char *) (AP)                    \
  115.                - ((sizeof (TYPE) < __va_rounded_size (char)    \
  116.                ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
  117. #endif /* big-endian */
  118.  
  119. /* Copy __gnuc_va_list into another variable of this type.  */
  120. #define __va_copy(dest, src) (dest) = (src)
  121.  
  122. #endif /* _STDARG_H */
  123.  
  124. #endif /* not TMS320C3x or TMS320C4x */
  125. #endif /* not v850 */
  126. #endif /* not mn10200 */
  127. #endif /* not mn10300 */
  128. #endif /* not sh */
  129. #endif /* not m32r */
  130. #endif /* not arc */
  131. #endif /* not powerpc with V.4 calling sequence */
  132. #endif /* not h8300 */
  133. #endif /* not alpha */
  134. #endif /* not i960 */
  135. #endif /* not sparc */
  136. #endif /* not mips */
  137. #endif /* not hppa */
  138. #endif /* not i860 */
  139. #endif /* not m88k */
  140. #endif /* not clipper */
  141.  
  142. #ifdef _STDARG_H
  143. /* Define va_list, if desired, from __gnuc_va_list. */
  144. /* We deliberately do not define va_list when called from
  145.    stdio.h, because ANSI C says that stdio.h is not supposed to define
  146.    va_list.  stdio.h needs to have access to that data type, 
  147.    but must not use that name.  It should use the name __gnuc_va_list,
  148.    which is safe because it is reserved for the implementation.  */
  149.  
  150. #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
  151. #undef _VA_LIST
  152. #endif
  153.  
  154. #ifdef _BSD_VA_LIST
  155. #undef _BSD_VA_LIST
  156. #endif
  157.  
  158. #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
  159. /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  160.    so we must avoid testing it and setting it here.
  161.    SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
  162.    have no conflict with that.  */
  163. #ifndef _VA_LIST_
  164. #define _VA_LIST_
  165. #ifdef __i860__
  166. #ifndef _VA_LIST
  167. #define _VA_LIST va_list
  168. #endif
  169. #endif /* __i860__ */
  170. typedef __gnuc_va_list va_list;
  171. #ifdef _SCO_DS
  172. #define __VA_LIST
  173. #endif
  174. #endif /* _VA_LIST_ */
  175. #else /* not __svr4__ || _SCO_DS */
  176.  
  177. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  178.    But on BSD NET2 we must not test or define or undef it.
  179.    (Note that the comments in NET 2's ansi.h
  180.    are incorrect for _VA_LIST_--see stdio.h!)  */
  181. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  182. /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
  183. #ifndef _VA_LIST_DEFINED
  184. /* The macro _VA_LIST is used in SCO Unix 3.2.  */
  185. #ifndef _VA_LIST
  186. /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
  187. #ifndef _VA_LIST_T_H
  188. typedef __gnuc_va_list va_list;
  189. #endif /* not _VA_LIST_T_H */
  190. #endif /* not _VA_LIST */
  191. #endif /* not _VA_LIST_DEFINED */
  192. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  193. #define _VA_LIST_
  194. #endif
  195. #ifndef _VA_LIST
  196. #define _VA_LIST
  197. #endif
  198. #ifndef _VA_LIST_DEFINED
  199. #define _VA_LIST_DEFINED
  200. #endif
  201. #ifndef _VA_LIST_T_H
  202. #define _VA_LIST_T_H
  203. #endif
  204.  
  205. #endif /* not _VA_LIST_, except on certain systems */
  206.  
  207. #endif /* not __svr4__ */
  208.  
  209. #endif /* _STDARG_H */
  210.  
  211. #endif /* not _ANSI_STDARG_H_ */
  212. #endif /* not _STDARG_H */
  213.